<%= simple_form_for @item, :html => {:multipart => true} do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.association :department, collection: Department.managing_items.order(:name) %>
    <%= f.association :location, :collection => Department.all, :as => :grouped_select, :group_method => :locations %>
    <%= f.input :name %>
    <%= f.association :owner %>
    <%= f.input :status, :as => :select, :collection => Item::STATUS_CHOICES %>
    <%= f.input :condition, :as => :select, :collection => Item::CONDITION_CHOICES %>
    <%= f.association :resource_type, :label => 'FEMA Resource Type' %>
    <%= f.association :item_type, :label => 'Item Type' %>
    <%= f.input :brand %>
    <%= f.input :model %>
    <%= f.input :qty %>
    <%= f.input :stock_number %>
    <%= f.input :description %>
    <%= f.association :vendor, label: "Vendor ", collection: Vendor.order("name") %>
    <%= link_to("Add a New Vendor", new_vendor_path(next: request.path)) if can?(:create, Vendor) %>
    <%= f.input :po_number %>
    <%= f.input :value, :placeholder => 'Replacement price' %>
    <%= f.input :grant, :placeholder => 'Grant name, if applicable' %>
    <%= f.input :grant_id, label: 'Granted by', :as => :select, :collection => Grant.active %>
    <%= f.input :purchase_date, as: :string,
                input_html: { class: 'datepicker', size: 11,
                              value: format_date_value(f.object.purchase_date) } %>
    <%= f.input :purchase_amt %>
    <%= f.input :sell_date, as: :string,
                input_html: { class: 'datepicker', size: 11,
                              value: format_date_value(f.object.sell_date) } %>
    <%= f.input :sell_amt %>
    Image
    <%= f.file_field :item_image %>
    <%= f.input :comments %>
  </div>

  <%= f.fields_for :unique_ids do |builder| %>
    <%= render 'unique_id_fields', f: builder %>
  <% end %>

  <div><%= link_to_add_fields "Add Unique ID", f, :unique_ids %></div>
<br/>
  <div class="form-actions">
    <%= f.button :submit %>
  </div>
<% end %>
